<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
    <meta http-equiv="pragram" content="no-cache">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>[title]</title>
    <link href="/Public/Home/css/style.css" rel="stylesheet" type="text/css">
    <link href="/Public/Home/css/iconfont.css" rel="stylesheet" type="text/css">
    <script src="/Public/Home/js/jquery-1.11.1.min.js"></script>
    <script src="/Public/Home/js/publicjquery.js"></script>
    <script src="/Public/Home/js/layer/layer.js" ></script>
    <script src="/Public/Home/js/common.js" ></script>
    <script src="/Public/Home/js/ajaxfileupload.js" ></script>
</head>
<body onselectstart="return false">
<div class="main">
	<div class="content">
		<div class="head-content">
			<div class="head-title">用户列表</div>
			<div class="head-search">
				<a href="<?php echo U('add');?>" class="form-button color-bg-yellow" >添加</a>
			</div>
		</div>
	</div>
	<div class="content">
		<div class="head-content">
		<form action="<?php echo U('User/index');?>" method='get'>
			<div class="head-search">
                <input class="form-input-small" type="text" value="<?php echo I('get.name');?>" name='name' placeholder="姓名" />
                <input class="form-input-small" type="text" value="<?php echo I('get.phone');?>" name='phone' placeholder="手机号" />

			</div>
		</form>
		</div>
	</div>
	<div class="table-list">
		<table cellpadding="0" cellspacing="0">
			<thead>
				<tr>
					<th>用户名</th>
					<th>电话</th>
					<th>网点ID</th>
					<th>快递点名称</th>
					<th>负责人</th>
					<th>用户角色</th>
					<th>地址</th>
					<th>状态</th>
					<th>创建时间</th>
					<th>操作</th>
				</tr>
			</thead>
		<?php if(is_array($list)): foreach($list as $key=>$vo): ?><tr>
				<td><?php echo ($vo['name']); ?></td>
				<td><?php echo ($vo['phone']); ?></td>
				<td><?php echo ($vo['roleid']); ?></td>
				<td><?php echo ($vo['express_name']); ?></td>
				<td><?php echo ($vo['header']); ?></td>
				<td><?php echo ((isset($vo['group']['title']) && ($vo['group']['title'] !== ""))?($vo['group']['title']):'-'); ?></td>
				<td><?php echo ((isset($vo['addr']) && ($vo['addr'] !== ""))?($vo['addr']):'-'); ?></td>
				<td><?php echo (get_user_status($vo['status'])); ?></td>
				<td><?php echo ($vo['create_time']); ?></td>
				<td>
					<div class="operate-list">
						<?php if($vo['status'] == 2): ?><button onclick="forbidden(<?php echo ($vo['id']); ?>,1)" style="float: none" class="form-button color-bg-green">禁用</button>
							<?php else: ?>
							<button onclick="forbidden(<?php echo ($vo['id']); ?>,2)" style="float: none" class="form-button color-bg-green">启用</button><?php endif; ?>

						<a class="heart" title='修改' href="<?php echo U('edit',array('id'=>$vo['id']));?>">
							<i class="iconfont">&#xe64f;</i>
						</a>
						<a class="delete" title='删除' onclick="info(<?php echo ($vo['id']); ?>)" href="javascript:void(0)">
							<i class="iconfont">&#xe62b;</i>
						</a>
					</div>
				</td>
			</tr><?php endforeach; endif; ?>
		</table>

		<!--没有结果时显示-->
		<?php if(!$list): ?><div class="nodata"><i class="iconfont">&#xe607;</i><span>没有查询到符合条件的记录</span></div><?php endif; ?>

		<!--分页效果-->
		<div class="table-foot">
			<div class="foot-page">
				<ul><?php echo ($page); ?></ul>
			</div>
		</div>

	</div>
</div>

<!--提示框-->
<div class="pop-window pop-delete" id="info">
	<input type="hidden" name="id" id="id"   >
	<div class="pop-notice FromUpToDown">
		<div class="notice-head">
			<div class="notice-head-title">温馨提示</div>
			<div class="notice-head-delete">×</div>
		</div>
		<div class="notice-content">
			<div>
				<i class="iconfont">&#xe607;</i>
			</div>
			<div class="notice-content-word">是否要删除本条信息？</div>
		</div>
		<div class="notice-foot">
			<a href="javascript:;" onclick="del()" class="notice-btn btn-submit">确定</a>
			<a href="javascript:;" class="notice-btn btn-drop">取消</a>
		</div>
	</div>
</div>

<div class="main-foot">Copyright  2013-2015 WeiGouTong.com. All Rights Reserved.  苏ICP备09098830号</div>

<script>
	//弹出询问框
	function info(id){
		$("#id").val(id);
		$("#info").show();
	}

	//删除
	function del(){
		$('#info').hide();
		var id = $("#id").val();
		$.get(
				"<?php echo U('del');?>",
				{
					id:id
				},
				function(res){
					if(res.status == false){
						layer.msg(res.info,{time:1000});
					}else{
						layer.msg(res.info,{time:1000});
						setTimeout("location.reload()",1000);
					}
				}
		);

	}

	function forbidden(id,status){
	var index = layer.confirm('确定禁用用户？', {
			btn: ['确定','取消'] //按钮
		}, function(){
		$.post(
				"<?php echo U('forbidden');?>",
				{
					id:id,
					status:status
				},function(res){
					layer.msg(res.info,{time:1000});
					setTimeout("location.reload()",1000);
				}
		)
		}, function(){
			layer.close(index);
		});
	}
</script>

</body>
</html>